package com.atguigu.ggkt.wechat.aspect;

import com.atguigu.ggkt.utils.LogTool;
import com.atguigu.ggkt.utils.SpringTool;
import me.chanjar.weixin.mp.api.WxMpService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Aspect
@Component
public class AppIdLogAspect {

    @Before("execution(public * me.chanjar.weixin.mp.api.WxMpService.*(..))")
    public void before(JoinPoint joinPoint) {
        String appId = (String)SpringTool.getProperty("wechat.mpAppId");
        LogTool.info(joinPoint.getSignature().getDeclaringType(), joinPoint.getSignature().getName()+", appId： "+appId);
    }
}
